<div class="content-form edit-aluno">
    
    <h2><?php echo $this->titulo; ?></h2>
    
    <?php echo $this->partial('aluno/menu.phtml', array('urlfoto'=>$this->urlfoto,'modulo'=>$this->modulo,'controller' => $this->controller, 'action' => $this->action, 'data' => $this->data)); ?>
    
    <div id="content-form">
        
        <div class="content-form-top">
        
            <h2>Boletim de Desempenho</h2>

            <div class="content-tl-btn">
                <span>Instituição</span> <a href="javascript:void(0)" class="add_op">+</a>
            </div>
        </div>
        
        <form id="form_aluno" action="" method="post" enctype="application/x-www-form-urlencoded">    
            <input type="hidden" id="ALU_ID" name="ALU_ID" value="<?php echo $this->data['ALU_ID']; ?>" />
            <?php 
            
            $query = 'SELECT SQL_CACHE * FROM ALUNO_HAS_BOLETIMREDACAO WHERE ALU_ID = '.$this->data['ALU_ID'].' ORDER BY ABR_ID ASC';
            $op_aluno = $this->db->fetchAll($query);
            foreach($op_aluno as $row_op_aluno){ 
            ?>
            <div class="row">
                <a href="javascript:void(0)" class="del_item">excluir</a>
                <a href="javascript:void(0)" class="add_item" itemid="<?php echo $row_op_aluno['ABR_ID']?>">novo</a>
                <div class="ln"><strong style="margin-right:10px;">Instituição</strong> 
                    <?php 
                        $html = '<select name="prova['.$row_op_aluno['ABR_ID'].']" class="chosen-select">';

                        $query = 'SELECT SQL_CACHE * FROM FACULDADE ORDER BY FAC_NOM ASC';
                        $row = $this->db->fetchAll($query);
                        foreach($row as $r){ 
                            $selected = $r['FAC_ID'] ==  $row_op_aluno['ABR_PRV']  ? 'selected=""':'';            
                            $html .= '<option '.$selected.' value="'.$r['FAC_ID'].'">'.$r['FAC_NOM'].'</option>'; 
                        }
                        echo $html .= '</select>';
                    ?>
                </div>
                <div class="ln" id="list<?php echo $row_op_aluno['ABR_ID']?>">
                    <?php
                        $query = 'SELECT SQL_CACHE * FROM BOLETIMREDACAO_HAS_PROVAS WHERE ABR_ID = '.$row_op_aluno['ABR_ID'].' ORDER BY BRP_ID ASC';
                        $row = $this->db->fetchAll($query);
                        foreach($row as $r){ 
                    ?>
                    <div class="list_item"> 
                        <a href="javascript:void(0)" class="del_item">excluir</a>
                        <input type="text" name="anosem[<?php echo $row_op_aluno['ABR_ID']?>][]" placeholder="Ano" value="<?php echo $r['BRP_ANOSEM']?>" />
                        <input type="text" class="nota" name="nota[<?php echo $row_op_aluno['ABR_ID']?>][]" placeholder="Nota" value="<?php echo $r['BRP_NTA']?>" />
                        <label><input type="checkbox" name="status[<?php echo $row_op_aluno['ABR_ID']?>][]" value="1" <?php echo $r['BRP_STA'] == 1 ? 'checked=""':'';?> /> Aprovado</label> 
                    </div>
                    <?php } ?>
                </div>
            </div>
            <?php } ?>
            <?php /* <script>$(function(){ $('.add_op').click(); });</script> */ ?>
            <br>
            <div class="row cnt-frm-btn">
                <input type="submit" name="submit" id="submitbutton" value="Salvar" class="btn-frm">

                <a href="<?php echo $this->urlmodulo.'/'.$this->controller; ?>" class="btn-frm">voltar</a>
            </div>
        </form>
    </div>
</div>
